import Button from "components/Base/Button";
import Icon from "components/Base/Icon";
import DataTable from "components/Base/DataTable";
import {getBpDeviceType, getEcgDeviceType} from "../../../../models/deviceType";

export default (self) => [
  {
    title: '日期',
    name: 'date',
    tableItem: {
    },
  },
  {
    title: '试剂',
    name: 'reagentId',
    formItem: {
      rules: [
        {
          required: true,
          message: '请选择试剂'
        }
      ],

      showSearch: true,
      type: 'select',
      loading: self.getAll("reagentType").loadingAll,  // 加载状态
      onDropdownVisibleChange: (visible) => {
        if (visible) {
          self.dispatch({
            type: `reagentType/getAll`,
          })
        }
      },

      filterOption: (input, option) => {
        return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
      },
      dict: self.getAll("reagentType").dict,
    }
  },
  {
    title: '类型',
    name: 'type',
    tableItem: {},
  },
  {
    title: '数量',
    name: 'count',
    tableItem: {},
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入数量'
        }
      ],
    }
  },
  {
    title: '批次',
    name: 'batch',
    tableItem: {},
  },
  {
    title: '医院',
    name: 'hospitalName',
    tableItem: {},
    formItem: {
      rules: [
        {
          required: true,
          message: '请选择医院'
        }
      ],

      showSearch: true,
      type: 'select',
      loading: self.getAll("hospital").loadingAll,  // 加载状态
      onDropdownVisibleChange: (visible) => {
        if (visible) {
          self.dispatch({
            type: `hospital/getAll`,
          })
        }
      },

      filterOption: (input, option) => {
        return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
      },
      dict: self.getAll("hospital").dict,
    }
  },
  {
    title: '操作',
    tableItem: {
      width: 180,
      render: (text, record) => (
        <DataTable.Oper>
          <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
            <Icon type="edit"/>
          </Button>
          <Button tooltip="删除" onClick={e => self.onDelete(record)}>
            <Icon type="trash"/>
          </Button>
        </DataTable.Oper>
      )
    }
  }
]
